package MyHashNet;

import java.util.HashSet;
import java.util.Iterator;
import java.util.function.Consumer;

public class demo1 {
    public static void main(String[] args) {
        HashSet<String> s = new HashSet<>();
        boolean result1 = s.add("zhangsan");
        boolean result2 = s.add("zhangsan");
        s.add("lisi");
        s.add("wangwu");
        System.out.println(result1);
        System.out.println(result2);
        Iterator<String> it = s.iterator();
//        while (it.hasNext()){
//            String s1 = it.next();
//            System.out.println(s1);
//        }
//        for (String string : s) {
//            System.out.println(string);
//        }
        s.forEach(string -> System.out.println(string));
    }
}
